package com.sedric.sort;

public class CommonUtils {

	public static Integer[] generatorRandomIntegerArray(int size) {
		Integer[] arr = new Integer[size];

		for(int i = 0; i < size; i++) {
			String data = String.valueOf(Math.random() * 10000);
			arr[i] = Integer.valueOf(data.substring(0, data.indexOf(".")));
		}
		return arr;
	}

	public static void printArray(Object[] arr) {
		if (null == arr) {
			return;
		}
		StringBuilder sb = new StringBuilder();
		for(Object tmp : arr) {
			sb.append(tmp).append("   ");
		}
		System.out.println(sb.toString());
	}

	public static void swap(Integer[] arr, int i, int j) {
		Integer tmp = arr[i];
		arr[i] = arr[j];
		arr[j] = tmp;
	}
}
